﻿using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using WMS.FC.Domain.DomainObject.System;

namespace WMS.FC.Infrastructure.Register
{
    public static class CrosRegister
    {
        public static void RegisterCros(this WebApplicationBuilder builder, WmsSettings wmsSettings)
        {
            builder.Services.AddCors(options =>
            {
                options.AddPolicy("allowOrigins", builder =>
                {
                    builder.WithOrigins(wmsSettings.AllowedOrigins).AllowAnyMethod().AllowAnyHeader();
                });
            });
        }
    }
}
